package com.xszx.controller;

import com.xszx.entity.Role;
import com.xszx.entity.User;
import com.xszx.service.RoleService;
import com.xszx.vo.AjaxJson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/role")
public class RoleController {
    @Autowired
    private RoleService roleService;
    @RequestMapping("/list")
    public AjaxJson getList(){
        AjaxJson j = new AjaxJson();
        try {
            List<Role> roleList = roleService.getRoleList();
            j.put("roleList",roleList);
        }catch (Exception e){
            j.setErrMsg(e.getMessage());
            j.setSuccess("false");
            e.printStackTrace();
        }
        return j;
    }
}
